<template>
  <view class="sign">
    <view class="top">
      <view class="left">
        <view class="up">#专业老师#</view>
        <view class="down ft-eng">Professional teachers</view>
      </view>
      <view class="more" @click="goTeaList">
        <text class="text">更多</text>
        <image class="icon" src="https://cdn.oss.bon-top.cn/static_bc/images/icon_left.png"></image>
      </view>
    </view>
    <scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="0">
      <view class="scroll-view-item_B mt-24" v-for="item in teacherList" :key="item.id" @click="goDetail(item.id)">
        <view class="first flex auto mt-20">
          <view class="avtor flex-center fs0">
            <view class="picture">
              <image class="wh-100" style="border-radius: 50%;" :src="item.avatar" mode="aspectFill"></image>
            </view>
          </view>
          <view class="name ml-24">
            <view class="shenfen ft" style="font-size: 20rpx; color: #999999">
              {{ item.title }}</view>
            <view class="mingchen ft mt-12" style="color: #333333; font-weight: 800; font-size: 28rpx">{{  item.nickname_show
            }}</view>
          </view>
        </view>

        <view class="wordpress auto pd-20 c-66 ft mt-20">
          <view class="text"> {{
            item.des
          }}</view>


        </view>
        <view class="button flex-center ml-20 mt-20">
          <text class="ft" style="color: #fff; margin-right: 8rpx">
            {{ "预约咨询" }}
          </text>
          <image class="wh-24 mt-2" src="https://cdn.oss.bon-top.cn/static_bc/images/icon11.png"></image>
        </view>
      </view>
    </scroll-view>
  </view>
</template>
<script lang="js" setup>
import { ref, onMounted } from "vue";
import { utils } from "@/utils/utils.js";
import { api } from "@/utils/api.js";


const goTeaList = () => {
  uni.navigateTo({
    url: '/subpackage/teacher/teacher',
  })
}

const goDetail = (id) => {
  uni.navigateTo({
    url: `/subpackage/teacher/teacherDetail?id=${id}`,
  })
}

//获取老师列表

const teacherList = ref([])
const getSaleListData = () => {
  utils
    .request(
      api.getSaleList,
      {
        page: 1,
        pageSize: 5,
        getReply: 1,
      },
      "get"
    )
    .then((res) => {
      teacherList.value = res.data.items;
      console.log(teacherList.value, "teacherList>>>>>>>>>>>");
    });
};
onMounted(() => {
  getSaleListData();
});
</script>
<style lang="scss" scoped>
.sign {
  padding-top: 12rpx;
  margin-top: 60rpx;
  width: 690rpx;
  min-height: 252rpx;
  background: linear-gradient(180deg, #fbffdf 0%, #ffffff 100%);
  border-radius: 40rpx 40rpx 40rpx 40rpx;

  .top {
    margin-top: 20rpx;
    width: 100%;
    display: flex;
    justify-content: space-between;

    .left {
      position: relative;
      flex: 1;
      height: 44rpx;

      .up {
        width: 100%;
        height: 44rpx;
        line-height: 44rpx;

        font-weight: 800;
        font-size: 32rpx;
        color: #333333;
        position: absolute;
        top: 0;
        left: 20rpx;
        z-index: 9;
      }

      .down {
        width: 100%;
        height: 44rpx;
        line-height: 44rpx;
        position: absolute;
        top: 0;
        left: 20rpx;
        font-weight: 400;
        font-size: 44rpx;
        color: #dbf046;
        opacity: 0.6;
        z-index: 2;
        top: 14rpx;
      }
    }

    .right {
      width: 176rpx;
      height: 54rpx;
      background: #333333;
      border-radius: 20rpx 20rpx 20rpx 20rpx;
      font-weight: 400;
      font-size: 24rpx;
      color: #dbf046;
      text-align: center;
      line-height: 54rpx;
      margin-right: 20rpx;
    }

    .more {
      width: 122rpx;
      margin-right: 20rpx;
      height: 54rpx;

      display: flex;
      justify-content: center;
      align-items: center;
      background: #ffffff;
      border-radius: 20rpx 20rpx 20rpx 20rpx;
      border: 2rpx solid #333333;

      .text {
        font-weight: 400;
        font-size: 24rpx;
        color: #333333;
        margin-right: 8rpx;
      }

      .icon {
        width: 24rpx;
        height: 24rpx;
      }
    }
  }

  .mildle {
    width: 100%;
    margin-top: 30rpx;
    display: flex;
    justify-content: space-between;

    .left {
      flex: 1;
      display: flex;
      margin-left: 20rpx;
      justify-content: space-evenly;
      align-items: center;

      .item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 110rpx;
        height: 116rpx;
        background: #ffffff;
        border-radius: 20rpx 20rpx 20rpx 20rpx;
        border: 2rpx solid #f1f1f1;

        .icon {
          width: 32rpx;
          height: 32rpx;
        }

        .date {
          font-weight: 400;
          font-size: 24rpx;
          color: #333333;
        }
      }
    }

    .right {
      margin-right: 20rpx;
      width: 252rpx;
      height: 114rpx;
      background: #dbf046;
      border-radius: 20rpx 20rpx 20rpx 20rpx;

      .icon {
        width: 100%;
        height: 100%;
      }
    }
  }

  .video {
    display: flex;
    width: 100%;
    justify-content: space-evenly;

    .one {
      width: 314rpx;
      height: 558rpx;
      background: #f1f1f1;
      border-radius: 40rpx 40rpx 40rpx 40rpx;
    }
  }

  .player {
    position: relative;
    width: 650rpx;
    height: 370rpx;
    background: #dbf046;
    border-radius: 40rpx 40rpx 40rpx 40rpx;

    .open {
      position: absolute;
      top: 22rpx;
      left: 32rpx;
      width: 158rpx;
      height: 48rpx;
      background: #fff;
      border-radius: 40rpx 40rpx 40rpx 40rpx;
      //border: 2rpx solid #333333;
      opacity: 0.8;

      .pos {
        position: absolute;
        top: 8rpx;
        left: 10rpx;
      }

      .pos1 {
        position: absolute;
        top: 8rpx;
        left: 52rpx;
      }
    }
  }

  .next {
    .one {
      position: relative;
      width: 314rpx;
      height: 184rpx;
      background: linear-gradient(90deg,
          #1746ff 0%,
          #1746ff 34%,
          rgba(23, 70, 255, 0) 100%);
      border-radius: 40rpx 40rpx 40rpx 40rpx;

      .btn {
        position: absolute;
        top: 10rpx;
        left: 10rpx;
        width: 276rpx;
        height: 52rpx;
        background: #ffffff;
        border-radius: 44rpx 44rpx 44rpx 44rpx;
        opacity: 0.6;

        .pos {
          position: absolute;
          top: 10rpx;
          left: 10rpx;
        }

        .pos1 {
          position: absolute;
          top: 10rpx;
          left: 52rpx;
        }
      }
    }
  }
}

.scroll-view_H {
  white-space: nowrap;
  width: 100%;
}

.scroll-view-item_B {
  display: inline-block;
  width: 380rpx;
  height: 398rpx;
  background: #ffffff;
  border-radius: 40rpx 40rpx 40rpx 40rpx;
  border: 2rpx solid #f1f1f1;
  margin-right: 20rpx;

  .first {
    box-sizing: border-box;
    // border: #9c0000 solid 2rpx;
    width: 100%;
    height: 88rpx;
    padding: 0 12rpx;

    .avtor {
      border-radius: 50%;
      width: 88rpx;
      height: 88rpx;
      border: solid 2rpx #dbf046;

      .picture {
        width: 72rpx;
        height: 72rpx;
      }
    }

    .name {}
  }

  .wordpress {

    width: 340rpx;
    height: 176rpx;
    background: #f8f8f8;
    border-radius: 20rpx 20rpx 20rpx 20rpx;

    .text {
      display: -webkit-box;
      word-break: break-all;
      white-space: pre-line;
      text-overflow: ellipsis;
      overflow: hidden;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 4;
    }
  }

  .button {
    width: 170rpx;
    height: 54rpx;
    background: #333333;
    border-radius: 20rpx 20rpx 20rpx 20rpx;
    color: #ffffff;

  }
}

.scroll-view-item_B:first-child {
  margin-left: 20rpx;
}
</style>